﻿using System.Collections.Generic;
using System.Threading.Tasks;
using Jinjia.Approve.Entity.Entity;
using Jinjia.Approve.IRepository;
using Jinjia.Core.UnitOfWork.UnitOfWorkComponent;
using SqlSugar;

namespace Jinjia.Approve.Repository
{
    public class ErpaUserRoleRepository : IErpaUserRoleRepository
    {
        private readonly ISqlSugarClient _db;

        public ErpaUserRoleRepository(IUnitOfWork unitOfWork)
        {
            _db = unitOfWork.GetDbClient();
        }

        public async Task<List<int>> GetUserIdsByUserRoleCode(List<string> user_role_code)
        {
            return await _db.Queryable<erpa_user_role_tbl>().In(a => a.role_code, user_role_code).Select(a => a.user_id).ToListAsync();
        }
    }
}